package com.yohann.designPattern.interpreter;

import java.util.HashMap;

/**
 * <p>
 * 变量表达
 * </p>
 *
 * @author Yohann
 * @since 2021/2/13 16:27
 */
public class VarExpression extends Expression {
    private String key;

    public VarExpression(String key) {
        this.key = key;
    }

    @Override
    public int interpreter(HashMap<String, Integer> var) {
        return var.get(key);
    }
}